<?php

function buetian_login_logo_url() {
    return get_bloginfo( 'url' );
}
add_filter( 'login_headerurl', 'buetian_login_logo_url' );
function buetian_login_logo_url_title() {
    return "Return to Homepage";
}
add_filter( 'login_headertitle', 'buetian_login_logo_url_title' );

function myan_sitemap_callback() {
	$cats = get_categories('exclude=');
	echo '<?xml version="1.0" encoding="UTF-8"?><urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">';
	foreach ($cats as $cat) 
	{
		//echo $cat->cat_name;
		$archive_query = new WP_Query('posts_per_page=-1&order=asc&orderby=title&cat='.$cat->cat_ID);
		while ($archive_query->have_posts()) 
		{
			echo "<url>";
			$archive_query->the_post();
			$category = get_the_category();
			//echo '<loc><li><a href="'.get_permalink().'" title="'.get_the_title().'">'.get_the_title().'</a></li></loc>';
			echo  '<loc>'.get_permalink().'</loc>';
			echo '<lastmod>'.get_the_modified_date('c').'</lastmod>';
			echo "</url>";
		}
	}
	echo '</urlset>';
	die;
}

/* header files */
function myan35802_load_scripts() {
	wp_deregister_script( 'jquery' );
?>
	<script type="text/javascript" id="rokeya_layout_SRC_JS" src="//bangla-keyboard-layout.googlecode.com/svn/trunk/rokeya_layout-4.4.73.js"></script>
	<script type="text/javascript" id="jQuery_JS" src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>

	<meta property="og:description" content="<?PHP 
	if(!is_home()) { 
		the_post();
		$text = get_the_excerpt();
		if( $text == '')	$text = get_bloginfo('description');
		echo strip_tags($text); 
		rewind_posts(); 
	} 
	else  
		echo strip_tags(get_bloginfo('description'));
	?>" />
	<meta property="og:url" content="<?php if(is_single()) { the_permalink(); } else bloginfo('siteurl'); ?>"/>
	<meta property="og:image" content="//farm8.staticflickr.com/7425/8716014895_6b22cd314c_z.jpg"/>
	<meta property="og:type" content="blog"/>
	<link rel="shortcut icon" href="<?php echo get_stylesheet_directory_uri();?>/images/panda_lunlun_headline_thumb.jpg" />
	
	<script>
	(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
	(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
	m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
	})(window,document,'script','//www.google-analytics.com/analytics.js','ga');

	ga('create', 'UA-10141449-1', 'mythicangel.com');
	ga('send', 'pageview');

	</script>
<?PHP
}
add_action('wp_head', 'myan35802_load_scripts');

/* rokeya layout */
function queueRokeyaLayout()
{
?>
<script type="text/javascript">  
if (typeof banglaLayout == "undefined")
{
	var h = document.getElementsByTagName('head')[0];
	var s = document.createElement('script');
	s.setAttribute('type','text/javascript');
	s.setAttribute('src','http://bangla-keyboard-layout.googlecode.com/svn/trunk/rokeya_layout-4.4.dev.js');
	h.appendChild(s);
}
// hook all textbox with conditions
var $textbox= jQuery("input:text, textarea").not('[noBanglaText]');
jQuery.each($textbox,function(index,valueOfElement){
	if(this.id == '')
	{
		this.id= Math.random();
	}
	new banglaLayout(this.id);
});
</script>
<?PHP
}
add_action('wp_footer', 'queueRokeyaLayout');
?>